<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>图片上传</title>
<#include "../head.html"/>
<style type="text/css">
.sel-disabled{background-color:#ccc}
</style>
</head>
<body>
<div class="box-positon">
	<div class="rpos">当前位置:  内容管理 - 修改</div>
	<form class="ropt">
		<input type="submit" value="返回列表" class="return-button"/>
    </form>
	<div class="clear"></div>
</div>
<div class="body-box">
<script type="text/javascript">
//上传图片
function upload(n) {
	var of = $("#uploadFile"+n);
	//检查是否选择了图片
	if(of.val()=="") {
		alert("请先选择图片");
		return;
	}
	//将file移动至上传表单
	$("#fileContent").empty();
	$("#fileContent").append(of);
	//复制一个file放至原处
	$("#ufc"+n).append(of.clone().attr("value",""));
	//修改属性
	$("#uploadFileText"+n).attr("value","");
	of.attr("id","");
	of.attr("name","uploadFile");
	//其他表单
	$("#ufFileName").val($("#fileName"+n).val());
	$("#ufWidth").val($("#zoomWidth"+n).val());
	$("#ufHeight").val($("#zoomHeight"+n).val());
	//先清除
	$("#ufMark").val("");
	$("#ufMark").val($("#mark"+n).val());
	$("#uploadNum").val(n);
	$("#uploadForm").submit();
}
//剪裁图片
function imgCut(n) {
	if($("#uploadImgPath"+n).val()=="") {
		alert("请先上传图片");
		return;
	}
	var url = "../common/v_image_area_select.do?uploadNum="+n+"&imgSrcPath="
		+$("#uploadImgPath"+n).val()+"&zoomWidth="+$("#zoomWidth"+n).val()+"&zoomHeight="+$("#zoomHeight"+n).val();
	window.open(url,"imgcut","height=550, width=1000, top=0, left=0, toolbar=no, menubar=no, scrollbars=auto, resizable=yes,location=no, status=no");
}
//预览图片
function previewImg(n) {
	var img = $("#uploadImgPath"+n).val();
	if(img!="") {
		if(img.indexOf("?")==-1) {
			$("#preImg"+n).attr("src",img+"?d="+new Date()*1);
		} else {
			$("#preImg"+n).attr("src",img+"&d="+new Date()*1);
		}
		if(!$("#preImg"+n).attr("noResize")) {
			$("#preImg"+n).css("width","auto");
			$("#preImg"+n).css("height","auto");
		}
	} else {
		$("#preImg"+n).removeAttr("src");		
	}
}
</script>
<form id="uploadForm" action="common/o_upload_image.do" method="post" enctype="multipart/form-data" target="hiddenIframe" style="display:none;width:0px;height:0px;">
<span id="fileContent"></span>
<input id="ufWidth" type="hidden" name="zoomWidth"/>
<input id="ufHeight" type="hidden" name="zoomHeight"/>
<input id="ufFileName" type="hidden" name="fileName"/>
<input id="ufMark" type="hidden" name="mark"/>
<input id="uploadNum" type="hidden" name="uploadNum"/>
</form>
<iframe name="hiddenIframe" frameborder="0" border="0" style="display:none;width:0px;height:0px;"></iframe>
<form method="post" action="o_update.do" id="jvForm">
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">

<tr id="tr-titleImg" style="display:none"></tr>
<tr id="tr-contentImg" style="display:none"></tr>
<tr id="tr-pictures">
<td width="10%" class="pn-flabel">图片集:</td><td colspan="3" width="90%" class="pn-fcontent">
<div><input class="add-picture" type="button" onclick="addPicLine();" value="增加一张图片"/></div>

<table id="picTable3" border="0" style="float:left;">
<tr>
	<td>
		<div><input type="text" id="uploadImgPath3" name="picPaths" style="width:170px"/> <a href="javascript:void(0);" onclick="$('#picTable3').remove();" class="pn-opt">删除</a></div>
		<div>
		<span id="ufc3" style="position:relative">
		<input type='text' id='uploadFileText3' size="10"/>  
		<input class="browse" type='button' value='浏览'/>
		<input onchange="$('#uploadFileText3').val(this.value)" size="10" type="file" id="uploadFile3" class="file-button"/>
		</span> 
		<input type="button" value="上传" onclick="upload(3);" class="upload-button"/>
		</div>
		<div><textarea style="width:200px;height:60px;" name="picDescs" maxlength="255"></textarea></div>
	</td>
	<td><img id="preImg3" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>

<table id="picTable4" border="0" style="float:left;">
<tr>
	<td>
		<div><input type="text" id="uploadImgPath4" name="picPaths" style="width:170px"/> <a href="javascript:void(0);" onclick="$('#picTable4').remove();" class="pn-opt">删除</a></div>
		<div>
		<span id="ufc4" style="position:relative">
		<input type='text' id='uploadFileText4' size="10"/>  
		<input class="browse" type='button' value='浏览'/>
		<input onchange="$('#uploadFileText4').val(this.value)" size="10" type="file" id="uploadFile4" class="file-button"/>
		</span> 
		<input type="button" value="上传" onclick="upload(4);" class="upload-button"/>
		</div>
		<div><textarea style="width:200px;height:60px;" name="picDescs" maxlength="255"></textarea></div>
	</td>
	<td><img id="preImg4" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>

<div id="picBefore" style="clear:both"></div>
<textarea id="picTable" style="display:none;">
<table id="picTable{0}" border="0" style="float:left;">
<tr>
	<td>
		<div><input type="text" id="uploadImgPath{0}" name="picPaths" style="width:160px"/> <a href="javascript:void(0);" onclick="$('#picTable{0}').remove();" class="pn-opt">删除</a></div>
		<div>
		<span id="ufc{0}" style="position:relative">
		<input type='text' id='uploadFileText{0}' size="10"/>  
		<input class="browse" type='button' value='浏览'/>
		<input onchange="$('#uploadFileText{0}').val(this.value)" size="10" type="file" id="uploadFile{0}" class="file-button"/>
		</span> 
		<input type="button" value="上传" onclick="upload({0});" class="upload-button"/>
		</div>
		<div>&lt;textarea style="width:200px;height:60px;" name="picDescs" maxlength="255"&gt;&lt;/textarea&gt;</div>
	</td>
	<td><img id="preImg{0}" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>
</textarea>
<script type="text/javascript">
var picIndex = 7;
var picTpl = $.format($("#picTable").val());
function addPicLine() {
	$('#picBefore').before(picTpl(picIndex++));
}
</script>
</td>
</tr>
<tr>
<td colspan="4" class="pn-fbutton">
    <input type="hidden" name="id" value="303"/>
	<input type="submit" value="提交" class="submit" class="submit"/> &nbsp; 
	<input type="reset" value="重置" class="reset" class="reset"/>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>